import { useRequire } from "@/api/instance";
import { Url } from "$/entity";

export const urlList = () => {
  return useRequire<Array<Url>>("/api/url/list");
};

export const urlAdd = (data: Omit<Url, "id" | "createTime" | "updateTime">) => {
  return useRequire("/api/url/add", { data });
};

export const urlUpdate = (id: string, data: Partial<Url>) => {
  return useRequire("/api/url/update", { id, data });
};

export const urlDelete = (id: string) => {
  return useRequire("/api/url/delete", { id });
};

export const urlTest = (data: Omit<Url, "id" | "createTime" | "updateTime">) => {
  return useRequire<string>("/api/url/test", { data });
};
